<template>
  <div class="m_content">
    <template v-for="section in pageData">
      <div
        :key="section.type"
        class="top_banner"
        v-if="section.type==1"
      >
        <el-carousel
          trigger="click"
          height="276px"
          :interval="4000"
        >
          <el-carousel-item
            v-for="(item, index) in section.data"
            :key="index"
          >
            <img
              class="w-100 h-100 top_banner_img"
              :src="item.img?$globalObj.imgBaseUrl+item.img:''"
              alt=""
            >
          </el-carousel-item>
        </el-carousel>
        <div class="mask">
          <img
            v-if="type==1"
            class="w-100 h-100"
            src="../../../../assets/images/iphoneX-top.png"
            alt=""
          >
          <img
            v-else
            class="w-100 h-100"
            src="../../../../assets/images/iphone7-top.png"
            alt=""
          >
        </div>
      </div>
      <div
        v-if="section.type==2"
        :key="section.type"
        class="inner flex flex-wrap nine_grid"
      >
        <template v-for="(item, index) in section.data">
          <div
            :key="index"
            class="flex-1 grid_item"
          >
            <el-image
              style="width:44px;height:45px;border-radius:50%"
              :src="item.img?$globalObj.imgBaseUrl+item.img:''"
            >
              <div
                slot="error"
                class="image-slot"
              >
                <i class="el-icon-picture-outline"></i>
              </div>
            </el-image>
            <p class="text-ellipsis title">{{item.title}}</p>
          </div>
        </template>
      </div>
      <div
        v-if="section.type==3"
        :key="section.type"
        class="inner capsule_banner"
      >
        <img
          class="w-100"
          style="border-radius:10px"
          :src="section.data&&section.data[0].img?$globalObj.imgBaseUrl+section.data[0].img:''"
          alt=""
        >
      </div>
      <div
        v-if="section.type==4"
        :key="section.type"
        class="inner third_hot"
      >
        <div
          style="height:207px"
          :style="{'background-image':section.data.main.backgroundImg?`url(${$globalObj.imgBaseUrl+section.data.main.backgroundImg})`:'none'}"
        > 
          
          <h5 class="text-ellipsis">
            <img
              class="hot_icon"
              src="../../../../assets/images/hot-icon.png"
              alt=""
            >
            {{section.data.main.title}}</h5>
          <p
            class="text-ellipsis"
            style="margin:9px 0;font-size:13px"
          >{{section.data.main.subtitle}}</p>
          <div class="flex">
            <template v-for="(thItem, index) in section.data.goods">
              <div
                :key="thItem.goods_id"
                class="flex-1 text-center th_item"
              >
                <span class="goods_icon">
                  <img
                    v-if="index==0"
                    src="../../../../assets/images/hot-Grade1.png"
                    alt=""
                  >
                  <img
                    v-if="index==1"
                    src="../../../../assets/images/hot-Grade2.png"
                    alt=""
                  >
                  <img
                    v-if="index==2"
                    src="../../../../assets/images/hot-Grade3.png"
                    alt=""
                  >
                </span>
                <img
                  style="width:77px;height:77px"
                  :src="thItem.imgurl?$globalObj.imgBaseUrl+thItem.imgurl:''"
                  alt=""
                >
                <p
                  class="text-ellipsis"
                  style="font-size:12px;margin-top:5px;margin-bottom:5px"
                >{{thItem.title}}</p>
                <p
                  style="font-size:12px"
                  class="color-999 text-ellipsis"
                ><span
                    style="font-size:14px"
                    class="red-font"
                  >￥{{thItem.price}}</span>/天起</p>
              </div>
            </template>
          </div>
        </div>
      </div>
      <div
        v-if="section.type==5"
        :key="section.type"
        class="inner flex banner_col"
      >
        <div class="banner_wrap">
          <el-carousel
            trigger="click"
            height="250px"
            :interval="4000"
          >
            <el-carousel-item
              v-for="(cItem, cIndex) in section.data.carousel"
              :key="cIndex"
            >
              <img
                class="w-100 h-100"
                style="border-radius:10px"
                :src="cItem.img?$globalObj.imgBaseUrl+cItem.img:''"
                alt=""
              >
            </el-carousel-item>
          </el-carousel>
        </div>
        <div class="flex flex-1 flex-column flex-between col_wrap">
          <div
            class="col_item"
            :style="{'background-image':section.data.twoBar.one.main.backgroundImg?`url(${$globalObj.imgBaseUrl+section.data.twoBar.one.main.backgroundImg})`:'none'}"
          >
            <h5
              style="max-width:145px;"
              class="text-ellipsis"
            >{{section.data.twoBar.one.main.title}}</h5>
            <p
              style="max-width:145px;font-size:13px;margin:5px 0 6px"
              class="text-ellipsis"
            >{{section.data.twoBar.one.main.subtitle}}</p>
            <p class="flex flex-between">
              <img
                style="width:65px;height:65px"
                v-for="(cg, cgIndex) in section.data.twoBar.one.goods"
                :key="cgIndex"
                :src="cg.imgurl?$globalObj.imgBaseUrl+cg.imgurl:''"
                alt=""
              >
            </p>
          </div>
          <div
            class="col_item"
            :style="{'background-image':section.data.twoBar.two.main.backgroundImg?`url(${$globalObj.imgBaseUrl+section.data.twoBar.two.main.backgroundImg})`:'none'}"
          >
            <h5
              style="max-width:145px;"
              class="text-ellipsis"
            >{{section.data.twoBar.two.main.title}}</h5>
            <p
              style="max-width:145px;font-size:13px;margin:5px 0 6px"
              class="text-ellipsis"
            >{{section.data.twoBar.two.main.subtitle}}</p>
            <p class="flex flex-between">
              <img
                style="width:65px;height:65px"
                v-for="(cg, cgIndex) in section.data.twoBar.two.goods"
                :key="cgIndex"
                :src="cg.imgurl?$globalObj.imgBaseUrl+cg.imgurl:''"
                alt=""
              >
            </p>
          </div>
        </div>
      </div>
      <div
        v-if="section.type==6"
        :key="section.type"
        class="flex inner two_col_goods"
      >
        <div
          class="flex-1 col_item"
          :style="{'background-image':section.data.one.main.backgroundImg?`url(${$globalObj.imgBaseUrl+section.data.one.main.backgroundImg})`:'none'}"
        >
          <h5 class="text-ellipsis">{{section.data.one.main.title}}</h5>
          <p
            class="text-ellipsis"
            style="margin:6px 0 11px"
          >{{section.data.one.main.subtitle}}</p>
          <div class="flex flex-between img_wrap">
            <div
              v-for="(gItem, gIndex) in section.data.one.goods"
              :key="gIndex"
              class="flex-1 text-center"
            >
              <img
                style="width:65px;height:65px"
                :src="gItem.imgurl?$globalObj.imgBaseUrl+gItem.imgurl:''"
                alt=""
              >
              <p
                class="text-ellipsis"
                style="font-size:12px"
              >￥{{gItem.price}}/天</p>
            </div>
          </div>
        </div>
        <div
          class="flex-1 col_item"
          :style="{'background-image':section.data.two.main.backgroundImg?`url(${$globalObj.imgBaseUrl+section.data.two.main.backgroundImg})`:'none'}"
        >
          <h5 class="text-ellipsis">{{section.data.two.main.title}}</h5>
          <p
            class="text-ellipsis"
            style="margin:6px 0 11px"
          >{{section.data.two.main.subtitle}}</p>
          <div class="flex flex-between img_wrap">
            <div
              v-for="(gItem, gIndex) in section.data.two.goods"
              :key="gIndex"
              class="flex-1 text-center"
            >
              <img
                style="width:65px;height:65px"
                :src="gItem.imgurl?$globalObj.imgBaseUrl+gItem.imgurl:''"
                alt=""
              >
              <p
                class="text-ellipsis"
                style="font-size:12px"
              >￥{{gItem.price}}/天</p>
            </div>
          </div>
        </div>
      </div>
      <div
        v-if="section.type==7"
        :key="section.type"
        class="inner sec_banner"
      >
        <el-carousel
          trigger="click"
          height="85px"
          :interval="4000"
        >
          <el-carousel-item
            v-for="(sItem, sIndex) in section.data"
            :key="sIndex"
          >
            <img
              class="w-100 h-100"
              style="border-radius:10px"
              :src="sItem.img?$globalObj.imgBaseUrl+sItem.img:''"
              alt=""
            >
          </el-carousel-item>
        </el-carousel>
      </div>
      <div
        v-if="section.type==8"
        :key="section.type"
        class="flex inner two_activity"
      >
        <div
          v-for="(aItem, aIndex) in section.data"
          :key="aIndex"
          class="flex-1 img_item"
          :style="{'background-image':aItem.img?`url(${$globalObj.imgBaseUrl+aItem.img})`:'none'}"
        >
        </div>
      </div>
      <div
        v-if="section.type==9"
        :key="section.type"
        class="inner cate_list"
      >
        <template v-for="(cateItem, cateIndex) in section.data">
          <div
            class="cate_item"
            :key="cateIndex"
          >
            <p class="header text-ellipsis text-center">{{cateItem.main.title}}</p>
            <img
              class="w-100 m_img"
              style="height:110px"
              :src="cateItem.main.img?$globalObj.imgBaseUrl+cateItem.main.img:''"
              alt=""
            >
            <div class="flex">
              <div
                class="flex-1 text-center cg_item"
                v-for="(cgItem, cgIndex) in cateItem.goods"
                :key="cgIndex"
              >
                <p><img
                    style="width:85px;height:85px"
                    :src="cgItem.imgurl?$globalObj.imgBaseUrl+cgItem.imgurl:''"
                    alt=""
                  ></p>
                <p
                  class="text-ellipsis"
                  style="font-size:12px;margin:4px 0 10px;"
                >{{cgItem.title}}</p>
                <p
                  class="red-font text-ellipsis"
                  style="font-size:12px"
                >￥<span style="font-size:14px">{{cgItem.price}}</span>/天</p>
              </div>
            </div>
          </div>
        </template>
      </div>
    </template>
  </div>
</template>

<script>
export default {
  props: ['type', 'pageData'],
  data() {
    return {

    }
  }
}
</script>

<style lang="scss" scoped>
.m_content {
  width: 100%;
  height: 100%;
  overflow: auto;
  &::-webkit-scrollbar {
    width: 4px;
  }
  &::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.2);
  }
  &::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    border-radius: 0;
    background: rgba(0, 0, 0, 0.1);
  }
}
/deep/.el-carousel__indicators--horizontal {
  display: none;
}
/deep/.el-carousel__arrow {
  display: none;
}
.top_banner {
  position: relative;
}
.mask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
}
.inner {
  padding: 0 15px;
  background-color: #f5f5f5;
}
.nine_grid {
  padding-top: 20px;
  padding-bottom: 10px;
}
.grid_item {
  width: 52px;
  margin-right: 20px;
  text-align: center;
  &:nth-child(5n + 5) {
    margin-right: 0;
  }
  .title {
    text-align: center;
    margin: 10px 0;
    font-size: 12px;
  }
}
.capsule_banner {
  padding-top: 11px;
  padding-bottom: 11px;
}
.th_item {
  position: relative;
  padding-top: 8px;
  padding-bottom: 8px;
  background-color: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  & + .th_item {
    margin-left: 10px;
  }
}
.third_hot {
  padding-top: 2px;
  padding-bottom: 3px;
  margin-bottom: 15px;
  & > div {
    padding: 15px 10px;
    border-radius: 15px;
    background-size: 100% 100%;
  }
  .hot_icon{
    width: 25px;
    height: 30px;
    vertical-align: sub;
  }
}
.goods_icon {
  position: absolute;
  top: 5px;
  left: 7px;
  z-index: 3;
  display: inline-block;
  width: 20px;
  height: 27px;
  img {
    width: 100%;
    height: 100%;
  }
}
.banner_wrap {
  width: 167px;
  border-radius: 10px;
}
.banner_col {
  margin-bottom: 15px;
  .col_wrap {
    margin-left: 10px;
  }
  .col_item {
    height: 120px;
    padding: 7px 10px 0;
    border-radius: 10px;
    overflow: hidden;
    background-size: 100% 100%;
  }
}
.two_col_goods {
  margin-bottom: 15px;
  .col_item {
    padding: 10px;
    overflow: hidden;
    background-size: 100% 100%;
  }
  .col_item:first-child {
    border-radius: 10px 0 0 10px;
  }
  .col_item:last-child {
    border-radius: 0 10px 10px 0;
  }
  .img_wrap {
    div {
      padding: 3px;
      border-radius: 10px;
      background-color: #ffffff;
    }
    div + div {
      margin-left: 10px;
    }
  }
}
.sec_banner {
  margin-bottom: 15px;
}
.two_activity {
  margin-bottom: 15px;
  .img_item {
    height: 80px;
    border-radius: 10px;
    background-size: 100% 100%;
  }
  .img_item + .img_item {
    margin-left: 10px;
  }
}
.cate_list .cate_item {
  padding: 10px;
  background-color: #ffffff;
  border-radius: 10px;
  margin-bottom: 15px;
  overflow: hidden;
  .header {
    width: 134px;
    height: 28px;
    font-size: 18px;
    line-height: 28px;
    margin: auto;
    background-image: url("../../../../assets/images/category-d.png");
    background-size: 100% 100%;
  }
  .m_img {
    border-radius: 10px;
    margin: 10px 0;
  }
  & + .cate_item {
    margin-left: 10px;
  }
}
.cg_item {
  overflow: hidden;
}
</style>
